package org.example.Controller;

import org.example.Pojo.Callbacks;
import org.example.Service.Impl.CallbacksServiceImpl;
import org.example.Utils.RequirePermission;
import org.example.Utils.UnionResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Callback")
public class CallbacksController {
    @Autowired
    CallbacksServiceImpl callbacksServiceImpl;
    @RequestMapping("/add")
    public UnionResult addCallbacks(Callbacks callbacks) {
        return callbacksServiceImpl.addCallback(callbacks);
    }
    @RequirePermission("m:callback")
    @RequestMapping("/get")
    public UnionResult getCallbacks() {
        return callbacksServiceImpl.getAllCallbacks();
    }
    @RequirePermission("m:callback")
    @RequestMapping("/update")
    public UnionResult updateCallbacks(Callbacks callbacks) {
        return callbacksServiceImpl.updateCallback(callbacks);
    }
    @RequestMapping("/remove")
    public UnionResult removeCallbacks(Callbacks callbacks) {
        return callbacksServiceImpl.removeCallback(callbacks);
    }
    @RequestMapping("/queryMy")
    public UnionResult queryMyCallbacks(String userid) {
        return callbacksServiceImpl.getMyCallbacks(userid);
    }
}
